<?php
/**
* @author Oliver Leisalu, Inditel Meedia
* @package DomFg
* @subpackage Cells
*/ 
class DomFgImage extends DomFgComponent {
	
	protected $title;
	
	protected $src;
	
	protected $html;
	
	protected $height;
	
	protected $imageWidth;
	
	protected $imageHeight;
	
	protected $center = true;
	
	public function __construct( $src = NULL ) {
		$this->title( $title );
	}
	
	public function title( $title ) {
		$this->title = $title;
		return $this;
	}
	
	public function src( $imageSrc ) {
		$this->src = $imageSrc;
		return $this;
	}
	
	public function html( $html ) {
		$this->html = $html;
		return $this;
	}
	
	public function imageWidth( $imageWidth ) {
		$this->imageWidth = (int)$imageWidth;
		return $this;
	}
	
	public function imageHeight( $imageHeight ) {
		$this->imageHeight = (int)$imageHeight;
		return $this;
	}
	
	public function center( $center ) {
		$this->center = (bool)$center;
		return $this;
	}
	
	public function render() {
		$renderer = $this->getRenderer();
		$renderer->assign('cell', $this );
		$type = strtolower(array_pop(explode('.',$this->src)));
		if( $type == 'swf' ) {
			$renderer->assign(imageType, 'flash');
		} else {
			$renderer->assign(imageType, 'image');
		}
		$renderer->assign(imageWidth, $this->imageWidth);
		$renderer->assign(imageHeight, $this->imageHeight);
		
		return $renderer->fetch('Cells/Image.html');
	}
	

}
?>